package com.wing.common.enums;

import java.util.Objects;

/**
 * @version 1.1.0
 * @Author hz
 * @Date 2024-08-21 14:15
 **/
public interface PurEnum {

    /**
     * 退货状态
     */
    enum returnGoodStatus{
        DSH("1","待审核"),
        DQS("2","待签收"),
        YQS("3","已签收"),
        WC("4","完成");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        returnGoodStatus(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            returnGoodStatus[] homeServiceStatuses = values();
            for (returnGoodStatus homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            returnGoodStatus[] homeServiceStatuses = values();
            for (returnGoodStatus homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    enum purReturnGoodStatus{
        DSH("1","待审核"),
        DFH("2","待发货"),
        YFH("3","已发货"),
        WC("4","完成");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        purReturnGoodStatus(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            purReturnGoodStatus[] homeServiceStatuses = values();
            for (purReturnGoodStatus homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            purReturnGoodStatus[] homeServiceStatuses = values();
            for (purReturnGoodStatus homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    /**
     * 换货状态
     */
    enum barterGoodStatus{
        DSH("1","待审核"),
        DQS("2","待(换货)签收"),
        YQS("3","已签收"),
        DFH("4","待(换货)发货"),
        YFH("5","已发货"),
        WC("6","完成");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        barterGoodStatus(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            barterGoodStatus[] homeServiceStatuses = values();
            for (barterGoodStatus homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            barterGoodStatus[] homeServiceStatuses = values();
            for (barterGoodStatus homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 状态
     */
    enum sendStatus{
        DQS("1","待签收"),
        QS("2","已签收"),
        TH("3","退货"),
        HH("4","换货"),
        WJ("5","完结");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        sendStatus(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            sendStatus[] homeServiceStatuses = values();
            for (sendStatus homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            sendStatus[] homeServiceStatuses = values();
            for (sendStatus homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 前端按钮类型
     */
    enum buttonTypes{
        UPDATE("1","修改"),
        SEND("2","发货"),
        GET("3","收货");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        buttonTypes(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            buttonTypes[] homeServiceStatuses = values();
            for (buttonTypes homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            buttonTypes[] homeServiceStatuses = values();
            for (buttonTypes homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    enum deliveryRecordTypes{
        CGDD("1","采购订单"),
        THH("2","退换货");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        deliveryRecordTypes(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            deliveryRecordTypes[] homeServiceStatuses = values();
            for (deliveryRecordTypes homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            deliveryRecordTypes[] homeServiceStatuses = values();
            for (deliveryRecordTypes homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 请购单生成订单流程
     */
    enum generatorType{
        WDY("0","未定义"),

        JYLC("1","简易采购流程"),

        FZLC("2","简易采购流程");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        generatorType(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            generatorType[] homeServiceStatuses = values();
            for (generatorType homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            generatorType[] homeServiceStatuses = values();
            for (generatorType homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 退货/换货
     */
    enum goodSellType{
        TH("1","收货"),
        HH("2","发货");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        goodSellType(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            goodSellType[] homeServiceStatuses = values();
            for (goodSellType homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            goodSellType[] homeServiceStatuses = values();
            for (goodSellType homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }


    /**
     * 销售退换申请单类型
     */
    enum moduleTypeBylogistics{
        XSTH("1","退货"),
        XSHH("2","换货");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        moduleTypeBylogistics(String code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(String code) {
            moduleTypeBylogistics[] homeServiceStatuses = values();
            for (moduleTypeBylogistics homeService : homeServiceStatuses) {
                if (Objects.equals(homeService.getCode(), code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static String getCodeByName(String name) {
            moduleTypeBylogistics[] homeServiceStatuses = values();
            for (moduleTypeBylogistics homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }
}
